package cn.tedu.boyou.acticle.domain;

import cn.tedu.boyou.common.domain.BaseDomain;
import com.alibaba.fastjson.JSON;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.HashMap;

@Setter@Getter
@NoArgsConstructor
@AllArgsConstructor
public class DestTheme extends BaseDomain{

    public static final int DEST_THEME_STATE_NORMAL = 1;
    public static final int DEST_THEME_STATE_FORBIDDEN = 0;

    private String name;    //主题名

    private Integer state = DEST_THEME_STATE_NORMAL; //主题发布状态

    private Integer sequence;   //主题显示时候排序的优先级

    private DestTheme parentTheme; //父级主题

    private String coverUrl = "/images/local/blank.gif";    //主题显示的图片

    private int deep = 2;   //主题所属层级

    public String getJsonString(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("state",state);
        map.put("sequence",sequence);
        map.put("coverUrl",coverUrl);
        map.put("deep",deep);
        if (parentTheme != null){
            map.put("parentId",parentTheme.getId());
            map.put("parentName",parentTheme.getName());
        }
        return JSON.toJSONString(map);
    }
}